
	.section .text

	.globl fatorial
	.type fatorial,@function

fatorial: 
	pushl %ebp
	movl (%esp),%ebp
	movl 8(%ebp),%eax
	pushl %eax
	movl $0,%eax
	cmpl	%eax,(%esp)
	jge .L1
	movl $1,%eax
	negl %eax
	jmp fatorial.conclusion
.L1:
	movl 8(%ebp),%eax
	pushl %eax
	movl $0,%eax
	cmpl	%eax,(%esp)
	jne .L2
	movl $1,%eax
	jmp fatorial.conclusion
	jmp .L3
.L2:
	movl 8(%ebp),%eax
	pushl %eax
	movl 8(%ebp),%eax
	pushl %eax
	movl $1,%eax
	subl	%eax,(%esp)
	popl	%eax
	pushl %eax
	call fatorial
	cltd
	imull	(%esp)
	popl	%eax
	jmp fatorial.conclusion
.L3:
fatorial.conclusion:
	movl %ebp,(%esp)
	popl %ebp
	ret

	.globl main
	.type main,@function

main: 
	pushl %ebp
	movl (%esp),%ebp
	movl $5,%eax
	pushl %eax
	call fatorial

#end program (exit)
	movl $1,%eax
	movl $0,%ebx
	int $0x80
